<?php
	/**
	 *  food.php  
	 *
	 * @version       v0.01
	 * @create time   2012-3-21
	 * @update time
	 * @author        liuxiaohui
	 * @copyright     Copyright (c) 微普科技 WiiPu Tech Inc. (http://www.wiipu.com)
	 * @informaition
	 */
	require_once("usercheck2.php");
	$tel=empty($_GET['tel'])?'':sqlReplace(trim($_GET['tel']));
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta name="Author" content="微普科技http://www.wiipu.com"/>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" href="../style.css" type="text/css"/>
  <script src="../js/jquery-1.3.1.js" type="text/javascript"></script>
  <script src="../js/tree.js" type="text/javascript"></script>
  <script type="text/javascript" src="js/upload.js"></script>
  <title> 用户列表 - 微普外卖点餐系统 </title>
 </head>
 <body>
 <div id="container">
	<?php
		require_once('header.php');
	?>
	<div id="main">
		<div class="main_content">
			<div class="main_top"></div>
			<div class="main_center main_center_r">
				<div id="shopLeft">
					<?php
						require_once('left.inc.php');
					?>
				</div>
				<div id="shopRight">
					<h1>用户列表</h1>
					<div id="introAdd">
						
						<form method="get" action="userlist.php">
							<p><label>手机号</label><input type="text" name="tel" class="input"/> <input type="submit" value="搜索"/></p>
						</form>
						
						<div class="moneyTable feeTable" style="width:668px;">
							<table width="100%">
								<tr>
									<td class="center">用户姓名</td>
									<td class="center">用户电话</td>
									<td class="center">登陆次数</td>
									<td class="center">查看订单</td>
									<td class="center">查看详细</td>
									<td class="center">删除</td>
								</tr>
								<?php
									$pagesize=20;
									$startRow=0;
									$where='';
									if (!empty($tel)){
										$where=" and user_phone='".$tel."'";
									}
									$sql="select * from ".WIIDBPRE."_user where 1=1".$where;
									$rs = mysql_query($sql) or die ("查询失败，请检查SQL语句。");
									$rscount=mysql_num_rows($rs);
									if ($rscount%$pagesize==0)
										$pagecount=$rscount/$pagesize;
									else
										$pagecount=ceil($rscount/$pagesize);

									if (empty($_GET['page'])||!is_numeric($_GET['page']))
										$page=1;
									else{
										$page=$_GET['page'];
										if($page<1) $page=1;
										if($page>$pagecount) $page=$pagecount;
										$startRow=($page-1)*$pagesize;
									}
									
									$sql="select user_id,user_name,user_phone,user_score,user_logincount from ".WIIDBPRE."_user where 1=1".$where." order by user_time desc limit $startRow,$pagesize";
									$rs=mysql_query($sql);
									if ($rscount==0){ 
										echo "<tr><td colspan='6' align='center'>暂无信息</td></tr></table>";
									}else{

										while($rows=mysql_fetch_assoc($rs)){
										
									?>
								<tr>
									<td class="center"><a href="userintro.php?id=<?php echo $rows['user_id']?>&tel=<?php echo $tel?>&page=<?php echo $page?>"><?php echo $rows['user_name']?></a></td>
									<td class="center"><?php echo $rows['user_phone']?></td>
									<td class="center"><?php echo $rows['user_logincount']?></td>
									<td class="center"><a href="userorder.php?uid=<?php echo $rows['user_id']?>&key=all">查看</a></td>
									<td class="center"><a href="userintro.php?id=<?php echo $rows['user_id']?>">查看</a></td>
									<td class="center" style='padding:5px 0;'><a href="javascript:if(confirm('您确定要删除吗？')){location.href='user_do.php?act=del&id=<?php echo $rows['user_id'];?>'}">删除</a></td>
								</tr>
									<?php
											}
									}
									?>					
							</table>
						<?php 
							if ($rscount>=1){
								echo showPage_admin('userlist.php',$page,$pagesize,$rscount,$pagecount);
							}
						?>
							
						</div>
						
					</div>
					
					
				</div>
				<div class="clear"></div>
			</div>
			<div class="main_bottom"></div>
		</div><!--main_content完-->
		
	
	</div>
	
	<?php
		require_once('footer.php');
	?>
 </div>
 </body>
  <script type="text/javascript">
	function check(){
		var f=$('#foodtype').val();
		if(f=="")
		{
			alert('菜单大类不能为空');
			$('#foodtype').focus();
			return false;
		}
	}
</script>

</html>
